package edu.winona.csclub.testing.testCode;

public class Commission {
	
	public static final int MAX_LOCKS = 77;
	public static final int MAX_STOCKS = 88;
	public static final int MAX_BARRELS = 99;

	public static void main(String[] args) {
		final double lockPrice = 35;
		final double stockPrice = 25;
		final double barrelPrice = 20;
		
		int totalLocks = Integer.parseInt(args[0]);
		int totalStocks = Integer.parseInt(args[1]);
		int totalBarrels = Integer.parseInt(args[2]);
		
		if(totalLocks < 0 || totalLocks > MAX_LOCKS)
			throw new IllegalArgumentException("value of locks (" + totalLocks + ") not in the range of permitted values");
		if(totalStocks < 0 || totalStocks > MAX_STOCKS)
			throw new IllegalArgumentException("value of stocks (" + totalStocks + ") not in the range of permitted values");
		if(totalBarrels < 0 || totalBarrels > MAX_BARRELS)
			throw new IllegalArgumentException("value of barrels (" + totalBarrels + ") not in the range of permitted values");
				
		double lockSales = lockPrice * totalLocks;
		double stockSales = stockPrice * totalStocks;
		double barrelSales = barrelPrice * totalBarrels;
		
		double commission, sales = lockSales + stockSales + barrelSales;
		if(sales > 1800) {
			commission = 0.1 * 1000;
			commission += 0.15 * 800;
			commission += 0.2 * (sales - 1800);
		} else if(sales > 1000) {
			commission = 0.1 * 1000;
			commission += 0.15 * (sales - 1000);
		} else
			commission = 0.1 * sales;
		
		System.out.println(commission);
	}
}